<template>
  <div>
    <practise-4
      v-for="(obj, index) in list"
      :key="index"
      :arr="obj"
      :index="index"
      @dogName="dogNameFn"
    ></practise-4>
    <ul>
      喜欢的🐕
      <li v-for="(item, index) in myArr" :key="index">{{ item }}</li>
    </ul>
  </div>
</template>

<script>
import Practise4 from "./components/practise4.vue";

export default {
  components: {
    Practise4,
  },
  data() {
    return {
      list: [
        {
          dogImgUrl:
            "http://nwzimg.wezhan.cn/contents/sitefiles2029/10146688/images/21129958.jpg",
          dogName: "博美",
        },
        {
          dogImgUrl:
            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1224576619,1307855467&fm=26&gp=0.jpg",
          dogName: "泰迪",
        },
        {
          dogImgUrl:
            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2967740259,1518632757&fm=26&gp=0.jpg",
          dogName: "金毛",
        },
        {
          dogImgUrl:
            "https://pic1.zhimg.com/80/v2-7ba4342e6fedb9c5f3726eb0888867da_1440w.jpg?source=1940ef5c",
          dogName: "哈士奇",
        },
        {
          dogImgUrl: "/img/shanghao.78ffe73d.jpg",
          dogName: "阿拉斯加",
        },
        {
          dogImgUrl: "/img/shanghao.78ffe73d.jpg",
          dogName: "萨摩耶",
        },
      ],
      myArr: [],
    };
  },
  methods: {
    dogNameFn(index) {
      this.myArr.push(this.list[index].dogName);
    },
  },
};
</script>

<style csoped>
ul {
  position: absolute;
  top: 0;
  right: 50px;
}
</style>